<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="description" content="通用跳转测试">
    <meta http-equiv=refresh content="0;url=com.bilibili.fatego://">
    <!--    <script src="https://static.mlinks.cc/scripts/dist/mlink.min.js"></script>-->
    <script src="https://static.jmlk.co/scripts/dist/jmlink.min.js"></script>
    <title>准有好事通用跳转测试</title>
    <style>
        .show {
            display: block;
        }

        .hidden {
            display: none;
        }

        button {
            margin: 5px;
        }
    </style>
</head>
<body>
<h4>##1.0.0连麦咨询</h4>
<button onclick="commonJsToNative('local','astrologer_home?id={$astr_id}&need_auth=0')">占星师主页</button>
<button onclick="commonJsToNative('local','chat?id={$chat_info["astr_id"]}&need_auth=2')">跳转到聊天页面</button>
<button onclick="commonJsToNative('local','chat_order_detail?id={$chat_info["id"]}&need_auth=2')">跳转到连线咨询详情</button>
<button onclick="commonJsToNative('local','hot_question?need_auth=0')">热门问题-大家都在问</button>
<button onclick="commonJsToNative('local','wallet?need_auth=2')">钱包</button>
<button onclick="commonJsToNative('local','chat_list?need_auth=2')">连线列表</button>
<button onclick="commonJsToNative('local','follow_list?need_auth=2')">关注列表</button>
<button onclick="commonJsToNative('local','coupon_list?need_auth=2')">卡券中心</button>
<button onclick="commonJsToNative('local','recode_list?need_auth=2')">档案列表</button>
<button onclick="commonJsToNative('local','message_center?need_auth=2')">系统消息</button>
<button onclick="commonJsToNative('local','setting?need_auth=0')">设置</button>
<button onclick="commonJsToNative('local','back')">触发APP本地返回按钮功能</button>
<button onclick="commonJsToNative('local','consult_astr_ask?need_auth=2')">立即咨询</button>
<br>
{foreach $area_zone as $v}
<button onclick="commonJsToNative('local','astro_area?type={$v["type"]}&need_auth=0')">{$v['name']}专区列表</button>
{/foreach}
<div id="toast" class="hidden"
     style="position: fixed;left: 10px;right: 10px;bottom: 20px;text-align: center;background: rgba(0,0,0,0.5);color: white;font-size: 10px;padding: 20px;border-radius: 10px;word-spacing: normal;word-wrap:break-word;word-break:normal; "></div>
</body>
<script src="/static/jquery-3.1.1.min.js"></script>
<script>
    var app_type = '{$app_type}'
    var version = '{$version}'

    /**
     * 通用跳转
     * @param target string 跳转方式
     * @param link string 跳转地址
     */
    function commonJsToNative(target, link) {
        if (!target)
            return;

        switch (app_type) {
            case 'ios':
                window.webkit.messageHandlers.commonJsToNative.postMessage({
                    'target': target,
                    'link': link
                });
                break;
            case 'android':
                console.log('android')
                androidwebview.commonJsToNative(target, link)
                break;
            default:
                console.log('not ios or android')
                if ('link' == target) {
                    window.location.href = link
                }
        }
    }
</script>
</html>
